<?php
/****
 *
 *采集
 */

require (CLASS_MODEL."caiji.class.php");

$obj = new caiji();

//新浪社会新闻采集
$sina_url  = "http://roll.news.sina.com.cn/news/shxw/shwx/index.shtml";
$sina_preg = "/<li><a href=\"(.*)\" target=\"_blank\">(.*)<\/a>/iUs";
$sina_name = "sina";
$sina_url_save_file = UPLOAD_FILE.$sina_name."/url".DATE_YMD.".".FILE_SUFFIX;
$sina_title_save_file = UPLOAD_FILE.$sina_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($sina_url_save_file,$sina_title_save_file,$sina_url,$sina_preg,$sina_name);

//社会与法新闻采集---网易感天动地
$wang_url  = "http://news.163.com/special/00013BUR/shehuiyf.html";
$wang_preg = "/<li><a href=\"(.*)\">(.*)<\/a>/iUs";
$wang_name= "falv";
$wang_url_save_file = UPLOAD_FILE.$wang_name."/url".DATE_YMD.".".FILE_SUFFIX;
$wang_title_save_file = UPLOAD_FILE.$wang_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($wang_url_save_file,$wang_title_save_file,$wang_url,$wang_preg,$wang_name);

//励志新闻采集---网易感天动地
$lizhi_url  = "http://news.163.com/special/00013BUR/gantiandd.html";
$lizhi_preg = "/<li><a href=\"(.*)\">(.*)<\/a>/iUs";
$lizhi_name= "lizhi";
$lizhi_url_save_file = UPLOAD_FILE.$lizhi_name."/url".DATE_YMD.".".FILE_SUFFIX;
$lizhi_title_save_file = UPLOAD_FILE.$lizhi_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($lizhi_url_save_file,$lizhi_title_save_file,$lizhi_url,$lizhi_preg,$lizhi_name);

//网易社会新闻
$wangyi_url  = "http://news.163.com/special/00013BUR/shehuibj.html";
$wangyi_preg = "/<li><a href=\"(.*)\">(.*)<\/a>/iUs";
$wangyi_name= "163";
$wangyi_url_save_file = UPLOAD_FILE.$wangyi_name."/url".DATE_YMD.".".FILE_SUFFIX;
$wangyi_title_save_file = UPLOAD_FILE.$wangyi_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($wangyi_url_save_file,$wangyi_title_save_file,$wangyi_url,$wangyi_preg,$wangyi_name);


//励志新闻采集
$qiwen_url  = "http://news.163.com/special/00013BUR/qiwenqs.html";
$qiwen_preg = "/<li><a href=\"(.*)\">(.*)<\/a>/iUs";
$qiwen_name= "qiwen";
$qiwen_url_save_file = UPLOAD_FILE.$qiwen_name."/url".DATE_YMD.".".FILE_SUFFIX;
$qiwen_title_save_file = UPLOAD_FILE.$qiwen_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($qiwen_url_save_file,$qiwen_title_save_file,$qiwen_url,$qiwen_preg,$qiwen_name);


//腾讯社会新闻采集
$qq_url  = "http://news.qq.com/newssh/shwx/shehuiwanxiang.htm";
$qq_preg = "/<a target=\"_blank\" href=\"(.*)\">(.*)<\/a>/iUs";
$qq_name= "qq";
$qq_url_save_file = UPLOAD_FILE.$qq_name."/url".DATE_YMD.".".FILE_SUFFIX;
$qq_title_save_file = UPLOAD_FILE.$qq_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($qq_url_save_file,$qq_title_save_file,$qq_url,$qq_preg,$qq_name,2);

//搜狐社会新闻
$sohu_url  = "http://news.sohu.com/bagua.shtml";
$sohu_preg = "/<a test=a href='(.*)' target='_blank'>(.*)<\/a>/iUs";
$sohu_name= "sohu";
$sohu_url_save_file = UPLOAD_FILE.$sohu_name."/url".DATE_YMD.".".FILE_SUFFIX;
$sohu_title_save_file = UPLOAD_FILE.$sohu_name."/title".DATE_YMD.".".FILE_SUFFIX;

$obj->default_caiji($sohu_url_save_file,$sohu_title_save_file,$sohu_url,$sohu_preg,$sohu_name);



//新浪网图片采集
$pho_sina_url_save_file = UPLOAD_IMAGE."pho_sina/".TODAY_YMD."url.".FILE_SUFFIX;
$pho_sina_title_save_file = UPLOAD_IMAGE."pho_sina/".TODAY_YMD."title.".FILE_SUFFIX;
$pho_sina_img_save_file = UPLOAD_IMAGE."pho_sina/".TODAY_YMD."/img.".FILE_SUFFIX;
$pho_sina_img_file = UPLOAD_IMAGE."pho_sina/".TODAY_YMD;

$pho_sina_url = "http://roll.news.sina.com.cn/picnews/shxw/index.shtml";
$pho_sina_preg = "/<td style=\"text-align:center;\"><a href=\"(.*)\" target=\"_blank\"><img src=\"(.*)\" alt=\"(.*)\" \/><\/a><\/td>/iUs";

$obj->pho_sina_caiji($pho_sina_url_save_file,$pho_sina_title_save_file,$pho_sina_img_save_file,$pho_sina_img_file,$pho_sina_url,$pho_sina_preg);


//凤凰网新闻采集
$if_url_save_file = UPLOAD_IMAGE."ifeng/".TODAY_YMD."url.".FILE_SUFFIX;
$if_title_save_file = UPLOAD_IMAGE."ifeng/".TODAY_YMD."title.".FILE_SUFFIX;
$if_img_save_file = UPLOAD_IMAGE."ifeng/".TODAY_YMD."img.".FILE_SUFFIX;
$if_cont_save_file = UPLOAD_IMAGE."ifeng/".TODAY_YMD."cont.".FILE_SUFFIX;
$if_img_file = UPLOAD_IMAGE."ifeng/".TODAY_YMD;

$if_conturl = "http://news.ifeng.com/photo/news/list_0/0.shtml";
$if_preg = "/<div class=\"cartoonimg\"><a href=\"(.*)\" target=\"_blank\"><img height=\"134\" border=\"0\" width=\"179\" src=\"(.*)\"><\/a><\/div>(.*)<div class=\"cartoonimgText\">(.*)<div class=\"summaryBox\">(.*)<h3><a href=\"(.*)\" class=\"sys_url\" target=\"_blank\">(.*)<\/a><\/h3>(.*)<p>(.*)<\/p>/iUs";

$obj->ifeng_caiji($if_url_save_file,$if_title_save_file,$if_img_save_file,$if_img_file,$if_cont_save_file,$if_conturl,$if_preg);

redirect("index.php",1);